package com.youxin.logprocess.common;

import com.youxin.foundation.utils.StringUtils;

/**
 * 全局变量
 * @author yingde.cao
 *
 */
public class MonitorGlobalConfig {	
	
	public final static String NGINX_LOG_NAME="nginxlog";
	public final static String MYSQL_LOG_NAME="mysqllog";
	public final static String REDIS_LOG_NAME="redislog";
	/**
	 * 开机启动延迟监控时间
	 */
	public final static long START_DELAY_TIME=4000L;
	/**
	 * 短信长度限制
	 */
	public static final int SMS_MESSAGE_LENGTH=70;
	public static final int NGINX_ALARM_COUNT=500;
	
	/**
	 * Zookeeper的锁
	 */
	public static final String ZOOKEEPER_LOCK_NAME="monitor_lock";
	/**
	 * 每个监控组本地最多保存的失败信息数
	 */
	public static final int DEFAULT_FAILURE_MAX_MESSAGE=20;
	/**
	 * 当前程序运行时的唯一ID,用于分布式保存信息使用,redis中会识别不同的APP
	 */
	public static final String APP_GUID=StringUtils.guid();
	
	/**
	 * 表示启用监控
	 */
	public static final int MONITOR_ON=1;
	private static MonitorGlobalConfig config=new MonitorGlobalConfig();	
	public static MonitorGlobalConfig instance()
	{
		return config;
	}
	
	private boolean isConnectWeb=false;
	public boolean isConnectWeb() {
		return isConnectWeb;
	}

	public void setConnectWeb(boolean isConnectWeb) {
		synchronized (this) {
			this.isConnectWeb = isConnectWeb;
		}
	}
	
}
